<?php
function upload(){
    define('__UPLOAD__','uploads');
    if($_FILES['up']['error'] > 0){
        die('文件上传错误');
    }
    if(is_uploaded_file($_FILES['up']['tmp_name'])){
        $fileUpload = __UPLOAD__.DIRECTORY_SEPARATOR.time().'.'.pathinfo($_FILES['up']['name'])['extension'];
        if(move_uploaded_file($_FILES['up']['tmp_name'],$fileUpload)){
            die('文件上传成功:'.$fileUpload);
        }
    }else{
        die('文件上传失败');
    }
}